import { getCookie, setCookie } from "@/utils/hsj";
const state = {
  theme: getCookie("theme") || "dark-theme",
};
const mutations = {
  SET_THEME(state) {
    document.body.classList.remove(state.theme);
    state.theme =
      state.theme === "normal-theme" ? "dark-theme" : "normal-theme";
    setCookie("theme", state.theme);
    document.body.classList.add(state.theme);
  },
  GET_THEME(state) {
    document.body.classList.add(state.theme || "normal-theme");
  },
};
const actions = {};

export default {
  namespaced: true,
  state,
  mutations,
  actions,
};
